﻿<?php   
       //include_once('init.php');
      if(!empty($_POST)) { 

       $_rows= add($GLOBALS['c'],$_POST);

    //判断影响的行数是否大于0，大于表示添加成功则跳到新闻列表页面，小于则失败则返回原来的页面
    if ($_rows>0) {
        echo '<script>alert("添加成功"); location.href="index.php?c=cate&a=list&admin=1";</script>';die;
        # code...
    }else{
        echo'<script>alert("添加成功");history.go(-1);</script>';die;
    }

      }
$id=empty($_GET['id'])?0:$_GET['id'];

  $sql="select * from `cate` where pid=$id";


  $result=mysqli_query($link,$sql);

//判断mysqli_query语句是否执行成功
  while($arr=mysqli_fetch_assoc($result)){

        $cate[]=$arr;

  }


if (!empty($_SERVER['HTTP_X_REQUESTED_WITH'])) { 

      echo json_encode($cate);die;
}


 include VIEW_PATH.$admin.'layout.html';


